package com.kede.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 物品包裹
 * @TableName t_package
 */
@TableName(value ="t_package")
@Data
public class PackageDomain implements Serializable {
    /**
     * 包裹编号
     */
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;

    /**
     * 物品id  多个中间用，（逗号）隔开
     */
    @TableField(value = "good_ids")
    private String goodIds;

    /**
     * 门店编号
     */
    @TableField(value = "store_id")
    private Integer storeId;

    /**
     * 区代编号
     */
    @TableField(value = "qu_id")
    private Integer quId;

    /**
     * 市代编号
     */
    @TableField(value = "shi_id")
    private Integer shiId;

    /**
     * 分类名称
     */
    @TableField(value = "cate_name")
    private String cateName;

    /**
     * 包含的个数
     */
    @TableField(value = "count")
    private Integer count;

    /**
     * 门店名称
     */
    @TableField(value = "store_name")
    private String storeName;

    /**
     * 区代名称
     */
    @TableField(value = "qu_name")
    private String quName;

    /**
     * 市代名称
     */
    @TableField(value = "shi_name")
    private String shiName;

    /**
     * 门店打包时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "store_create_time")
    private LocalDateTime storeCreateTime;

    /**
     * 包裹状态 1正常 2待区代审核 3区代正常 4市代审核 5市代正常 6运输 7完成
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 区代打包时间
     */
    @TableField(value = "qu_create_time")
    private LocalDateTime quCreateTime;

    /**
     * 市代打包时间
     */
    @TableField(value = "shi_create_time")
    private LocalDateTime shiCreateTime;

    /**
     * 运输编号
     */
    @TableField(value = "transport_no")
    private String transportNo;

    /**
     * 拒签说明
     */
    @TableField(value = "reason")
    private String reason;

    /**
     * 重量
     */
    @TableField(value = "weight")
    private BigDecimal weight;

    /**
     * 物品详情
     */
    @TableField(exist = false)
    private List<ZhiOrderGoodsListDomain> goodsList = new ArrayList<>();

    /**
     * 价值总额度
     */
    @TableField(exist = false)
    private BigDecimal totalMoney;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        PackageDomain other = (PackageDomain) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getGoodIds() == null ? other.getGoodIds() == null : this.getGoodIds().equals(other.getGoodIds()))
            && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
            && (this.getQuId() == null ? other.getQuId() == null : this.getQuId().equals(other.getQuId()))
            && (this.getShiId() == null ? other.getShiId() == null : this.getShiId().equals(other.getShiId()))
            && (this.getCateName() == null ? other.getCateName() == null : this.getCateName().equals(other.getCateName()))
            && (this.getCount() == null ? other.getCount() == null : this.getCount().equals(other.getCount()))
            && (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName()))
            && (this.getQuName() == null ? other.getQuName() == null : this.getQuName().equals(other.getQuName()))
            && (this.getShiName() == null ? other.getShiName() == null : this.getShiName().equals(other.getShiName()))
            && (this.getStoreCreateTime() == null ? other.getStoreCreateTime() == null : this.getStoreCreateTime().equals(other.getStoreCreateTime()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getQuCreateTime() == null ? other.getQuCreateTime() == null : this.getQuCreateTime().equals(other.getQuCreateTime()))
            && (this.getShiCreateTime() == null ? other.getShiCreateTime() == null : this.getShiCreateTime().equals(other.getShiCreateTime()))
            && (this.getTransportNo() == null ? other.getTransportNo() == null : this.getTransportNo().equals(other.getTransportNo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getGoodIds() == null) ? 0 : getGoodIds().hashCode());
        result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
        result = prime * result + ((getQuId() == null) ? 0 : getQuId().hashCode());
        result = prime * result + ((getShiId() == null) ? 0 : getShiId().hashCode());
        result = prime * result + ((getCateName() == null) ? 0 : getCateName().hashCode());
        result = prime * result + ((getCount() == null) ? 0 : getCount().hashCode());
        result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode());
        result = prime * result + ((getQuName() == null) ? 0 : getQuName().hashCode());
        result = prime * result + ((getShiName() == null) ? 0 : getShiName().hashCode());
        result = prime * result + ((getStoreCreateTime() == null) ? 0 : getStoreCreateTime().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getQuCreateTime() == null) ? 0 : getQuCreateTime().hashCode());
        result = prime * result + ((getShiCreateTime() == null) ? 0 : getShiCreateTime().hashCode());
        result = prime * result + ((getTransportNo() == null) ? 0 : getTransportNo().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", goodId=").append(goodIds);
        sb.append(", storeId=").append(storeId);
        sb.append(", quId=").append(quId);
        sb.append(", shiId=").append(shiId);
        sb.append(", cateName=").append(cateName);
        sb.append(", count=").append(count);
        sb.append(", storeName=").append(storeName);
        sb.append(", quName=").append(quName);
        sb.append(", shiName=").append(shiName);
        sb.append(", storeCreateTime=").append(storeCreateTime);
        sb.append(", status=").append(status);
        sb.append(", quCreateTime=").append(quCreateTime);
        sb.append(", shiCreateTime=").append(shiCreateTime);
        sb.append(", transportNo=").append(transportNo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}